package com.aat.dxfy.rmi.demo2;

import java.util.Enumeration;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NameClassPair;

import com.aat.dxfy.rmi.demo1.Warehouse;

public class WarehouseClient {

	public static void main(String[] args) throws Exception {
		Context ctx=new InitialContext();
		Enumeration<NameClassPair> e=ctx.list("rmi://127.0.0.1/");
		while(e.hasMoreElements())
			System.out.println(e.nextElement().getName());
		
		String url="rmi://127.0.0.1/house";
		Warehouse house=(Warehouse) ctx.lookup(url);
		double price=house.getPrice("aa");
		System.out.println("aa:"+price);
	}

}
